<!--
  @Description:编辑个人资料
  @author Wangshu
  @date 2019/8/26
-->

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="__PUBLIC__/css/common/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/css/header.css">
    <link rel="stylesheet" href="__PUBLIC__/css/changeData.css">
    <link rel="stylesheet" href="__PUBLIC__/css/menu.css">
    <link rel="stylesheet" href="__PUBLIC__/css/common/common.css">
    <title>山东科技大学技术转移公共服务平台-编辑个人资料</title>
</head>
<body>
<head>
    <div class="top-title">
        <div>
            <span>欢迎登陆山东科技大学技术转移公共服务平台！</span>
            <if condition="$uid eq null">
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('login/index')}">登录</a>
                    <span class="spece">|</span>
                    <a href="{:url('login/signup')}">注册</a>
                </div>
                <else/>
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('me/me')}">欢迎你！</a>
                    <a href="{:url('me/me')}">{$user.real_name}</a>
                </div>
            </if>
        </div>
    </div>
    <div class="logo-box">
        <div class="logo-wrap">
            <div>
                <img src="__PUBLIC__/asset/fodder/logo.png" alt="">
            </div>
            <div>
                <div class="search">
                    <div class="dropdown">
                        人才检索
                        <img src="__PUBLIC__/asset/icon/dropdown.png" alt="">
                    </div>
                    <div class="search-block">
                        <input type="text">
                    </div>
                    <div class="submit">
                        <img src="__PUBLIC__/asset/icon/search.png" alt="">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="nav-box">
        <div class="nav-list">
            <ul>
                <li><a href="{:url('/index/index')}">首页</a></li>
                <li><a href="{:url('news/index')}">新闻</a></li>
                <li><a href="{:url('people/index')}">人才库</a></li>
                <li><a href="{:url('fruit/index')}">成果库</a></li>
                <if condition="$user_type eq 0">
                <li><a href="{:url('requirement/index')}">需求库</a></li>
                </if>
                <li  class=""><a href="{:url('me/callme')}">联系我们</a></li>
            </ul>
        </div>
    </div>
</head>
<main>
    <div class="content-wrap">
        <div class="menu-left">
            <div class="title">个人中心</div>
            <ul>
                <li class="active">
                    <a href="./me.html">个人资料</a>
                    <img class="active-arrow" src="__PUBLIC__/asset/icon/right_arrow.png" alt="">
                </li>
                <if condition="$user_type eq 0">
                <li><a href="fruit">我发布的成果</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                </if>
                <li><a href="requirement">我发布的需求</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <if condition="$user_type eq 0">

                <li><a href="team">我的团队</a><img src="__PUBLIC__/asset/icon/right_arrow.png"
                                            alt=""></li>
                </if>
                <li><a href="collection">我的收藏</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <li><a href="FAQ.html">常见问题</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <li><a href="callme.html">联系客服</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <li><a href="other.html">其他设置</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
            </ul>
        </div>
        <div class="menu-right">
            <div class="title">
                <div>个人资料</div>
                <div>当前位置：<span>个人中心/个人资料</span></div>
            </div>
            <div class="content">
                <div class="option">
                    <div>头像：</div>
                    <input id="imageInput" class="imageinput" style="display: none;" type="file"
                           accept="image/jpeg,image/jpg,image/png"/>
                    <div class="img-box">
                        <if condition="$member.head_img neq null">
                            <img class="imageView" src="{$member.head_img}" alt=""
                                 onclick="selectImage()">
                            <else/>
                            <img class="imageView" src="__PUBLIC__/asset/fodder/header.png" alt="" onclick="selectImage()">
                        </if>
                    </div>
                </div>
                <div class="option">
                    <div>姓名：</div>
                    <div class="text-box"><input type="text" placeholder="请输入姓名" name="real_name" id="real_name" value="{$member.real_name}"> </div>
                </div>
                <div class="option">
                    <div>手机号：</div>
                    <div class="text-box"><input type="text" placeholder="请输入手机号码" name="phone" id="phone" value="{$member.phone}"></div>
                </div>


                <div class="option">
                    <div>企业名称：</div>
                    <div class="text-box"><input type="text" placeholder="请输入企业名称" name="company" id="company" value="{$member.company}"></div>
                </div>
                <div class="save ml190">
                    <div id="save">保存修改</div>
                </div>
            </div>

        </div>
    </div>
</main>
<footer>
    <div class="foot-line">
        <span>青岛校区地址：山东省青岛市黄岛区前湾港路579号</span>
        <span>邮政编码：266590</span>
        <span>联系电话：0532-80698028\80698027\80678029</span>
        <span>传真：0532-80698029</span>
    </div>
    <div class="foot-line">
        <span>泰安校区地址：山东省泰安市岱宗大街223号</span>
        <span>邮政编码：271019</span>
        <span>联系电话：0538-3076489</span>
        <span>传真：0538-3076489</span>
    </div>
    <div class="last-line">
        Copyright©2019 　山东科技大学 　鲁ICP备09051012号
        <span style="line-height: 26px ; margin-left: 20px;"><img
                style="width: 44px;height: 17px; margin-right: 10px;vertical-align: middle"
                src="__PUBLIC__/asset/fodder/todo_white.png" alt=""><span
                style="vertical-align: middle">投道科技提供技术支持</span></span>
    </div>
</footer>
<div class="pop-box">
    <div class="pop">
        <img class="close" src="__PUBLIC__/asset/icon/close.png" alt="">
        <div class="logo"><img src="__PUBLIC__/asset/icon/success.png" alt=""></div>
        <p id="popText">您的个人资料保存成功</p>
        <div class="affirm">
            <div id="affirmBtn">确定</div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/public/jquery-1.11.3.min.js"></script>
<script src="__PUBLIC__/js/public/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/layer/layer/layer.js"></script>
<script>
    $('#save').click(function () {

        var image = $(".imageView").attr('src')
        var name = $("#real_name").val();
        var phone = $("#phone").val()
        var company = $("#company").val()


        const data = {
            image,
            real_name: name,
            phone,
            company
        }
        console.log(data)
        $.post("{:url('me/saveMember')}", data, function (res) {
            if(res.code == 0){
                layer.msg(res.msg, {icon: 1}, function () {
                    window.location.reload()

                    return false;
                });
            }else{
                layer.msg(res.msg, {icon: 1}, function () {
                    window.location.reload()
                    return false;
                });
            }
        });
    })

    var selectCollege = null;
    function shows1(a,id) {
        selectCollege = {id,college:a};
        $("#dropdownMenu1").text(a);
    }


    $("#submit").on('click',function () {
        var name = $("#keyword").val();
        if(!selectCollege){
            window.open("{:url('people/index')}?keyword="+name)
        }else{
            window.open("{:url('people/index')}?college_id="+selectCollege.id+"&keyword="+name)
        }
    })

    function selectImage() {
        $("#imageInput").click();
    }

    $(".imageinput").change(function () {
        didLoadImage(this);
    });
    function didLoadImage(x) {
        //取出选择的图片
        var fileInput = x.files[0];
        //判断是否选择了图片
        if (x.files && x.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                //此处得到是图片的base64编码数据
                imagUrl = e.target.result;
                console.log(e);
                $(".imageView").attr('src', imagUrl);
                //展示哪个样式
                if (imagUrl) {
                    $('.showImage').css('display', 'inline-flex');
                    $(".input_ImageItem").css('display', 'none');
                } else {
                    $(".upLoadText").css('display', 'inline-flex');
                    $(".imageView").css('display', 'none');
                }
            };
            reader.readAsDataURL(x.files[0]);
        }
    }


</script>
</body>
</html>


